﻿<html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script src="../jquery-3.1.1.min.js"></script>
<link rel="stylesheet" type="text/css" href="content.css">
<script>
$(document).ready(function(){
	$(".answer,.id").hide();
	var value;
	var id;
    $(".btn").click(function(){
		$.ajax({ 
            type:"post",  
            url:"../../index.php?m=index&c=content&a=article",   
            data:'response='+$(".text").val()+'&title='+$(".title").html()+'&id='+$(".id").html(), 
            success:function(content){
				if(content=== "请先登录!"){
					alert(content);
				}else{
					$(".text").after(content);
				}
			}
		});		
	});
	$(document).on("click",".response",function(){
		$(this).next().after($(".answer").show());	
		id=$(this).prev().prev().html();
		value=$(this).prev().html();	
	});	
	$(".button").click(function(){	
		$.ajax({ 
            type:"post",  
            url:"../../index.php?m=index&c=content&a=article",   
            data:'title='+$(".title").html()+'&answer='+value+'&pid='+id+'&ans='+$(".ans").val(), 
            success:function(content){
				if(content== "请先登录!"){
					alert(content);
				}else{
					$(".answer").after('<br>'+content).hide();
					$(".ans").val("");
				}
		$(".responses").click(function(){
			$(this).next().after($(".answer").show());
			id=$(".resp .cid:last").html();
			value=$(this).prev().prev().html();	
		});	
			}
		});
	});	
});
</script>
<body>
<div class="id">{id}</div>
<div class="answer"><input type="text" class="ans">&nbsp <input type="button" value="回复" class="button"></div>
<div class="main">
<h2 class="title"></h2>
时间:<span class="datetime"></span>&nbsp&nbsp&nbsp 来源:<span class="source"></span>
</div>
<div class="cont">

</div>
<div class="resp">

</div>
<div>
<input type="text" class="text">
</div>
<div class="buttons"><input type="button" value="回复" class="btn"></div>
<body>
</html>

